package com.hunny.prototype;

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;

import java.util.ArrayList;

/**
 * @author Create By Cb
 * @since 2022/4/25 10:45
 */
@Slf4j
public class DeepClone extends StudentPrototype {

    @Override
    @SuppressWarnings("unchecked")
    public StudentPrototype clone() {
        StudentPrototype studentPrototype;
        studentPrototype = (StudentPrototype) super.clone();

        studentPrototype.hobbies = (ArrayList<String>) this.hobbies.clone();

        return studentPrototype;
    }

    @Override
    public void show() {
        log.warn("深克隆");
    }
}